package o;

import androidx.annotation.Nullable;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
import java.nio.ByteBuffer;

public class aok extends aay {
    private long ʽ;
    private final DecoderInputBuffer ˊ = new DecoderInputBuffer(1);
    private final anc ˋ = new anc();
    @Nullable
    private aoi ˎ;
    private final abk ˏ = new abk();
    private long ॱ;

    public aok() {
        super(5);
    }

    public int ˎ(Format format) {
        return "application/x-camera-motion".equals(format.ʽ) ? 4 : 0;
    }

    public void ˎ(int i, @Nullable Object obj) throws ExoPlaybackException {
        if (i == 7) {
            this.ˎ = (aoi) obj;
        } else {
            super.ˎ(i, obj);
        }
    }

    public void ˏ(Format[] formatArr, long j) throws ExoPlaybackException {
        this.ॱ = j;
    }

    public void ˏ(long j, boolean z) throws ExoPlaybackException {
        ʾ();
    }

    public void ॱˎ() {
        ʾ();
    }

    public void ˊ(long j, long j2) throws ExoPlaybackException {
        while (!ᐝ() && this.ʽ < 100000 + j) {
            this.ˊ.ˊ();
            if (ˊ(this.ˏ, this.ˊ, false) == -4 && !this.ˊ.ˏ()) {
                this.ˊ.ᐝ();
                this.ʽ = this.ˊ.ˏ;
                if (this.ˎ != null) {
                    float[] ˊ = ˊ(this.ˊ.ॱ);
                    if (ˊ != null) {
                        ((aoi) anr.ˎ(this.ˎ)).ˋ(this.ʽ - this.ॱ, ˊ);
                    }
                }
            } else {
                return;
            }
        }
    }

    public boolean ʽॱ() {
        return ᐝ();
    }

    public boolean ˈ() {
        return true;
    }

    @Nullable
    private float[] ˊ(ByteBuffer byteBuffer) {
        if (byteBuffer.remaining() != 16) {
            return null;
        }
        this.ˋ.ॱ(byteBuffer.array(), byteBuffer.limit());
        this.ˋ.ˋ(byteBuffer.arrayOffset() + 4);
        float[] fArr = new float[3];
        for (int i = 0; i < 3; i++) {
            fArr[i] = Float.intBitsToFloat(this.ˋ.ᐝॱ());
        }
        return fArr;
    }

    private void ʾ() {
        this.ʽ = 0;
        if (this.ˎ != null) {
            this.ˎ.ˎ();
        }
    }
}
